/**
 * Created by Administrator on 2017/3/24 0024.
 */
var Page0={
    create:function () {
        var page={};
        page.ui=new PIXI.DisplayObjectContainer();

        var bg=new PIXI.Sprite(resource['assets/images/p0_bg.png'].texture);
        page.ui.addChild(bg);

        var logo=new PIXI.Sprite(resource['assets/images/p0_logo.png'].texture);
        logo.anchor.set(0.5);
        logo.x=370;
        logo.y=148;
        page.ui.addChild(logo);

        var t0=new PIXI.Sprite(resource['assets/images/p0_t0.png'].texture);
        t0.x=112;
        t0.y=543;
        page.ui.addChild(t0);

        var mask0=new PIXI.Graphics();
        mask0.beginFill();
        mask0.drawRect(0,0,800,400);
        mask0.endFill();
        mask0.x=-728;
        mask0.y=486;
        page.ui.addChild(mask0);

        var t1=new PIXI.Sprite(resource['assets/images/p0_t1.png'].texture);
        t1.x=467;
        t1.y=675;
        page.ui.addChild(t1);

        var t2=new PIXI.Sprite(resource['assets/images/p0_t2.png'].texture);
        t2.x=151;
        t2.y=900;
        // page.ui.addChild(t2);

        var t3=new PIXI.Sprite(resource['assets/images/p0_t3.png'].texture);
        t3.x=52;
        t3.y=960;
        page.ui.addChild(t3);

        var t4=new PIXI.Sprite(resource['assets/images/p0_t4.png'].texture);
        t4.x=52;
        t4.y=960;
        page.ui.addChild(t4);

        var mask1=new PIXI.Graphics();
        mask1.beginFill();
        mask1.drawRect(0,0,395,440);
        mask1.endFill();
        mask1.x=54;
        mask1.y=647;
        page.ui.addChild(mask1);

        t0.mask=mask0;
        t1.mask=mask1;

        page.In=function () {

            logo.y=148+50;
            logo.alpha=0;
            TweenMax.to(logo,1,{delay:1,y:148,alpha:1,ease:Linear.easeNone});
            TweenMax.to(mask0,1,{delay:1,x:-205,ease:Linear.easeNone});
            TweenMax.to(mask1,1,{delay:2,x:304,ease:Linear.easeNone});

            t3.alpha=0;
            t3.y=960;
            TweenMax.to(t3,1.5,{delay:3,alpha:1,y:960,ease:Cubic.easeInOut});
            TweenMax.to(t3,1.5,{delay:6,alpha:0,y:860,ease:Cubic.easeInOut});

            t4.alpha=0;
            t4.y=1030;
            TweenMax.to(t4,1.5,{delay:6.5,alpha:1,y:960,ease:Cubic.easeInOut});
            TweenMax.to(t4,1.5,{delay:9.5,alpha:0,y:860,ease:Cubic.easeInOut});

            // t2.x=151+100;
            // t2.alpha=0;
            // TweenMax.to(t2,1.5,{delay:17,x:151,alpha:1,ease:Cubic.easeInOut});

            setTimeout(function () {
                var evt=new CustomEvent('Game_PageIn',{'detail':1});
                document.dispatchEvent(evt);
            },10000)
        };
        page.Out=function () {

        };


        return page;
    }
}